package com.acme;

import java.util.Random;

public class Task4Arrays {
	
	public static int[] randomArray () {
		Random rand = new Random ();
		
		int[] array = new int[10];
		for (int i = 0; i <10; i++){
			int r = rand.nextInt(90);
			
			if (r <= 30) array[i] = 3;
			else if (r <= 60) array[i] = 6;
			else array[i] = 9;
		}
		return array;
	}
	
	public static int numberOfN (int[] array, int n) {
		int num = 0;
		for (int i : array) 
			if (i == n)
				num++;
		return num;
	}

	public static void main(String[] args) {
		int[] testArray = randomArray ();
		
		for (int i : testArray)
			System.out.print(i);
		System.out.println("");
		
		System.out.println("Nuber of 3: " + numberOfN(testArray, 3));
		System.out.println("Nuber of 6: " + numberOfN(testArray, 6));
		System.out.println("Nuber of 9: " + numberOfN(testArray, 9));	

	}

}
